package com.xinzhidi.web.dataanalysis.service;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.xinzhidi.common.constant.AgreementConstants;
import com.xinzhidi.web.build.domain.BuildUnit;
import com.xinzhidi.web.build.domain.CBuild;
import com.xinzhidi.web.build.service.IBuildUnitService;
import com.xinzhidi.web.build.service.ICBuildService;
import com.xinzhidi.web.dataanalysis.domain.po.DataAnalysisPo;
import com.xinzhidi.web.dataanalysis.domain.vo.*;
import com.xinzhidi.web.dataanalysis.mapper.DataAnalysisMapper;
import com.xinzhidi.web.house.domain.Household;
import com.xinzhidi.web.house.service.IHouseholdService;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.stream.Collectors;

@Service
public class DataAnalysisService {
    @Autowired
    private DataAnalysisMapper analysisMapper;

    @Autowired
    private ICBuildService buildService;

    @Autowired
    private IBuildUnitService buildUnitService;

    @Autowired
    private IHouseholdService householdService;


    public List<FaultAnalysisVo> faultAnalysis(DataAnalysisPo po) {
        List<FaultAnalysisVo> list;
        if (AgreementConstants.DataType.PLOT.equals(po.getType())) {
            list = analysisMapper.faultPlotAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD.equals(po.getType())) {
            list = analysisMapper.faultBuildAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD_UNIT.equals(po.getType())) {
            list = analysisMapper.faultUnitAnalysis(po);
        } else {
            list = analysisMapper.faultHouseholdAnalysis(po);
        }
        if (CollectionUtils.isEmpty(list)) {
            return Lists.newArrayList();
        }
        return list;
    }

    public DataOverview dataOverview(DataAnalysisPo po) {
        //室外温度
        List<OverviewVo> outdoorTemperatureList;
        //室内温度
        List<OverviewVo> roomTemperatureList;
        //供水温度
        List<OverviewVo> waterSupplyTemperatureList;
        //回水温度
        List<OverviewVo> returnWaterTemperatureList;
        //区间累计热量
        List<OverviewVo> intervalAccumulatedHeatList = Lists.newArrayList();
        //总累计热量
        List<OverviewVo> totalAccumulatedHeatList = Lists.newArrayList();
        //区间累计流量
        List<OverviewVo> intervalAccumulatedFlowList = Lists.newArrayList();
        //总累计流量
        List<OverviewVo> totalAccumulatedFlowList = Lists.newArrayList();
        if (AgreementConstants.DataType.PLOT.equals(po.getType())) {
            outdoorTemperatureList = analysisMapper.dataOverviewPlotOutdoorTemperature(po);
            roomTemperatureList = analysisMapper.dataOverviewPlotTemperature(po);
            waterSupplyTemperatureList = analysisMapper.waterSupplyTemperaturePlotAvgAnalysis(po);
            returnWaterTemperatureList = analysisMapper.returnWaterTemperaturePlotAvgAnalysis(po);

            for (Long id : po.getIds()) {
                OverviewVo HeatOverviewVo = analysisMapper.getIntervalPlotHeat(po, id);
                OverviewVo totalHeatOverviewVo = analysisMapper.getTotalPlotHeat(id);
                OverviewVo intervalAccumulatedFlowVo = analysisMapper.getVelocityFlowPlotAnalysis(po, id);
                OverviewVo totalAccumulatedFlowVo = analysisMapper.getVelocityPlotAnalysis(id);
                totalAccumulatedHeatList.add(totalHeatOverviewVo);
                intervalAccumulatedHeatList.add(HeatOverviewVo);
                intervalAccumulatedFlowList.add(intervalAccumulatedFlowVo);
                totalAccumulatedFlowList.add(totalAccumulatedFlowVo);
            }
            DataAnalysisPo p = new DataAnalysisPo();
            if (p.getStartTime() != null) {
                p.setStartTime(null);
            }
            if (p.getEndTime() != null) {
                p.setEndTime(null);
            }
            DataAnalysisPo pp = new DataAnalysisPo();
            if (pp.getStartTime() != null) {
                pp.setStartTime(null);
            }
            if (pp.getEndTime() != null) {
                pp.setEndTime(null);
            }
        } else if (AgreementConstants.DataType.BUILD.equals(po.getType())) {
            outdoorTemperatureList = analysisMapper.dataOverviewBuildOutdoorTemperature(po);
            roomTemperatureList = analysisMapper.dataOverviewBuildTemperature(po);
            waterSupplyTemperatureList = analysisMapper.waterSupplyTemperatureBuildAvgAnalysis(po);
            returnWaterTemperatureList = analysisMapper.returnWaterTemperatureBuildAvgAnalysis(po);

            for (Long id : po.getIds()) {
                OverviewVo HeatOverviewVo = analysisMapper.getIntervalBuildHeat(po, id);
                OverviewVo totalHeatOverviewVo = analysisMapper.getTotalBuildHeat(id);
                OverviewVo intervalAccumulatedFlowVo = analysisMapper.getVelocityFlowBuildAnalysis(po, id);
                OverviewVo totalAccumulatedFlowVo = analysisMapper.getVelocityBuildAnalysis(id);
                intervalAccumulatedHeatList.add(HeatOverviewVo);
                totalAccumulatedHeatList.add(totalHeatOverviewVo);
                intervalAccumulatedFlowList.add(intervalAccumulatedFlowVo);
                totalAccumulatedFlowList.add(totalAccumulatedFlowVo);
            }
//
            DataAnalysisPo p = new DataAnalysisPo();
            if (p.getStartTime() != null) {
                p.setStartTime(null);
            }
            if (p.getEndTime() != null) {
                p.setEndTime(null);
            }

            DataAnalysisPo pp = new DataAnalysisPo();
            if (pp.getStartTime() != null) {
                pp.setStartTime(null);
            }
            if (pp.getEndTime() != null) {
                pp.setEndTime(null);
            }
        } else if (AgreementConstants.DataType.BUILD_UNIT.equals(po.getType())) {
            outdoorTemperatureList = analysisMapper.dataOverviewUnitOutdoorTemperature(po);
            roomTemperatureList = analysisMapper.dataOverviewUnitTemperature(po);
            waterSupplyTemperatureList = analysisMapper.waterSupplyTemperatureUnitAvgAnalysis(po);
            returnWaterTemperatureList = analysisMapper.returnWaterTemperatureUnitAvgAnalysis(po);
            for (Long id : po.getIds()) {
                OverviewVo HeatOverviewVo = analysisMapper.getIntervalUnitHeat(po, id);
                OverviewVo totalHeatOverviewVo = analysisMapper.getTotalUnitHeat(id);
                OverviewVo intervalAccumulatedFlowVo = analysisMapper.getVelocityFlowUnitAnalysis(po, id);
                OverviewVo totalAccumulatedFlowVo = analysisMapper.getVelocityBuildUnitAnalysis(id);
                intervalAccumulatedHeatList.add(HeatOverviewVo);
                totalAccumulatedHeatList.add(totalHeatOverviewVo);
                intervalAccumulatedFlowList.add(intervalAccumulatedFlowVo);
                totalAccumulatedFlowList.add(totalAccumulatedFlowVo);
            }
            DataAnalysisPo p = new DataAnalysisPo();
            if (p.getStartTime() != null) {
                p.setStartTime(null);
            }
            if (p.getEndTime() != null) {
                p.setEndTime(null);
            }
            DataAnalysisPo pp = new DataAnalysisPo();
            if (pp.getStartTime() != null) {
                pp.setStartTime(null);
            }
            if (pp.getEndTime() != null) {
                pp.setEndTime(null);
            }
        } else {
            outdoorTemperatureList = analysisMapper.dataOverviewHouseholdOutdoorTemperature(po);
            roomTemperatureList = analysisMapper.dataOverviewHouseholdTemperature(po);
            waterSupplyTemperatureList = analysisMapper.waterSupplyTemperatureHouseholdAvgAnalysis(po);
            returnWaterTemperatureList = analysisMapper.returnWaterTemperatureHouseholdAvgAnalysis(po);
            for (Long id : po.getIds()) {
                OverviewVo HeatOverviewVo = analysisMapper.getIntervalhouseholdHeat(po, id);
                OverviewVo totalHeatOverviewVo = analysisMapper.getTotalHouseholdHeat(id);
                OverviewVo intervalAccumulatedFlowVo = analysisMapper.getVelocityFlowHouseholdAnalysis(po, id);
                OverviewVo totalAccumulatedFlowVo = analysisMapper.getVelocityhouseholdAnalysis(id);
                intervalAccumulatedHeatList.add(HeatOverviewVo);
                totalAccumulatedHeatList.add(totalHeatOverviewVo);
                intervalAccumulatedFlowList.add(intervalAccumulatedFlowVo);
                totalAccumulatedFlowList.add(totalAccumulatedFlowVo);
            }

            DataAnalysisPo p = new DataAnalysisPo();
            if (p.getStartTime() != null) {
                p.setStartTime(null);
            }
            if (p.getEndTime() != null) {
                p.setEndTime(null);
            }
            DataAnalysisPo pp = new DataAnalysisPo();
            if (pp.getStartTime() != null) {
                pp.setStartTime(null);
            }
            if (pp.getEndTime() != null) {
                pp.setEndTime(null);
            }
        }


        DataOverview dataOverviewVo = new DataOverview();
        dataOverviewVo.setOutdoorTemperatureList(outdoorTemperatureList);
        dataOverviewVo.setRoomTemperatureList(roomTemperatureList);
        dataOverviewVo.setWaterSupplyTemperatureList(waterSupplyTemperatureList);
        dataOverviewVo.setReturnWaterTemperatureList(returnWaterTemperatureList);
        dataOverviewVo.setIntervalAccumulatedHeatList(intervalAccumulatedHeatList);
        dataOverviewVo.setTotalAccumulatedHeatList(totalAccumulatedHeatList);
        dataOverviewVo.setIntervalAccumulatedFlowList(intervalAccumulatedFlowList);
        dataOverviewVo.setTotalAccumulatedFlowList(totalAccumulatedFlowList);
        dataOverviewVo.setNameList(roomTemperatureList.stream().map(OverviewVo::getName).collect(Collectors.toList()));
        return dataOverviewVo;
    }


    public Map<String, List<HeatAnalysisVo>> heatAnalysis(DataAnalysisPo po) {
        List<HeatAnalysisVo> list;
        if (AgreementConstants.DataType.PLOT.equals(po.getType())) {
            list = analysisMapper.heatPlotAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD.equals(po.getType())) {
            list = analysisMapper.heatBuildAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD_UNIT.equals(po.getType())) {
            list = analysisMapper.heatUnitAnalysis(po);
        } else {
            list = analysisMapper.heatHouseholdAnalysis(po);
        }

        if (CollectionUtils.isEmpty(list)) {
            return new HashMap<>();
        }
        //目前返回的日期格式为年-月-日 时  用java的stream把日期格式的分和秒补：00
        list.stream().forEach(x -> {
            x.setCreateTime(x.getCreateTime() + ":00:00");
        });

        String type = po.getType();
        for (HeatAnalysisVo vo : list) {
            if (type.equals(AgreementConstants.DataType.PLOT)) {
                vo.setName(vo.getPlotName());
            } else if (type.equals(AgreementConstants.DataType.BUILD)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName());
            } else if (type.equals(AgreementConstants.DataType.BUILD_UNIT)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName() + "-" + vo.getUnitName());
            } else if (type.equals(AgreementConstants.DataType.HOUSEHOLD)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName() + "-" + vo.getUnitName() + "-" + vo.getHouseNumber());
            }
        }
        Map<String, List<HeatAnalysisVo>> collect;
        Map<String, List<HeatAnalysisVo>> returnMap = new HashMap<>();
        collect = list.stream().collect(Collectors.groupingBy(HeatAnalysisVo::getName));

        Iterator<Map.Entry<String, List<HeatAnalysisVo>>> entries = collect.entrySet().iterator();
        List<HeatAnalysisVo> mapValue;
        String mapKey;
        while (entries.hasNext()) {
            Map.Entry<String, List<HeatAnalysisVo>> entry = entries.next();
            mapKey = entry.getKey();
            mapValue = entry.getValue();
//            mapValue = FormatData.getTIme(mapValue, po.getTimePoint());
            returnMap.put(mapKey, mapValue);
        }
        return returnMap;
    }

    public Map<String, List<VelocityFlowAnalysisVo>> velocityFlowAnalysis(DataAnalysisPo po) {
        List<VelocityFlowAnalysisVo> list;
        if (AgreementConstants.DataType.PLOT.equals(po.getType())) {
            list = analysisMapper.velocityFlowPlotAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD.equals(po.getType())) {
            list = analysisMapper.velocityFlowBulidAnalysis(po);
            // 使用自定义比较器对列表进行排序
        } else if (AgreementConstants.DataType.BUILD_UNIT.equals(po.getType())) {
            list = analysisMapper.velocityFlowUnitAnalysis(po);
        } else {
            list = analysisMapper.velocityFlowHouseAnalysis(po);
        }

        //目前返回的日期格式为年-月-日 时  用java的stream把日期格式的分和秒补：00
        list.stream().forEach(x -> {
            x.setCreateTime(x.getCreateTime() + ":00:00");
        });

        if (CollectionUtils.isEmpty(list)) {
            return new HashMap<>();
        }

        Map<String, List<VelocityFlowAnalysisVo>> collect;
        Map<String, List<VelocityFlowAnalysisVo>> returnMap = new HashMap<>();
        collect = list.stream().collect(Collectors.groupingBy(VelocityFlowAnalysisVo::getName));

        Iterator<Map.Entry<String, List<VelocityFlowAnalysisVo>>> entries = collect.entrySet().iterator();
        List<VelocityFlowAnalysisVo> mapValue;
        String mapKey;
        while (entries.hasNext()) {
            Map.Entry<String, List<VelocityFlowAnalysisVo>> entry = entries.next();
            mapKey = entry.getKey();
            mapValue = entry.getValue();
//            mapValue = FormatData.getTIme(mapValue, po.getTimePoint());
            returnMap.put(mapKey, mapValue);
        }
        return returnMap;
    }

    public Map<String, List<TemperatureAnalysisVo>> temperatureAnalysis(DataAnalysisPo po) {
        List<TemperatureAnalysisVo> list;
        if (AgreementConstants.DataType.PLOT.equals(po.getType())) {
            list = analysisMapper.temperaturePlotAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD.equals(po.getType())) {
            list = analysisMapper.temperatureBuildAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD_UNIT.equals(po.getType())) {
            list = analysisMapper.temperatureUnitAnalysis(po);
        } else {
            list = analysisMapper.temperatureHouseholdAnalysis(po);
        }
        if (CollectionUtils.isEmpty(list)) {
            return new HashMap<>();
        }

        //目前返回的日期格式为年-月-日 时  用java的stream把日期格式的分和秒补：00
        list.stream().forEach(x -> {
            x.setReportTime(x.getReportTime() + ":00:00");
        });

        String type = po.getType();
        for (TemperatureAnalysisVo vo : list) {
            if (type.equals(AgreementConstants.DataType.PLOT)) {
                vo.setName(vo.getPlotName());
            } else if (type.equals(AgreementConstants.DataType.BUILD)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName());
            } else if (type.equals(AgreementConstants.DataType.BUILD_UNIT)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName() + "-" + vo.getUnitName());
            } else if (type.equals(AgreementConstants.DataType.HOUSEHOLD)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName() + "-" + vo.getUnitName() + "-" + vo.getHouseNumber());
            }
        }
        Map<String, List<TemperatureAnalysisVo>> collect;
        Map<String, List<TemperatureAnalysisVo>> returnMap = new HashMap<>();
        collect = list.stream().collect(Collectors.groupingBy(TemperatureAnalysisVo::getName));

        Iterator<Map.Entry<String, List<TemperatureAnalysisVo>>> entries = collect.entrySet().iterator();
        List<TemperatureAnalysisVo> mapValue;
        String mapKey;
        while (entries.hasNext()) {
            Map.Entry<String, List<TemperatureAnalysisVo>> entry = entries.next();
            mapKey = entry.getKey();
            mapValue = entry.getValue();
//            mapValue = FormatData.getTIme(mapValue, po.getTimePoint());
            returnMap.put(mapKey, mapValue);
        }
        return returnMap;
    }


    public Map<String, List<HeatAnalysisVo>> waterSupplyTemperatureAnalysis(DataAnalysisPo po) {
        List<HeatAnalysisVo> list;
        if (AgreementConstants.DataType.PLOT.equals(po.getType())) {
            list = analysisMapper.waterSupplyTemperaturePlotAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD.equals(po.getType())) {
            list = analysisMapper.waterSupplyTemperatureBuildAnalysis(po);
            // 使用自定义比较器对列表进行排序
        } else if (AgreementConstants.DataType.BUILD_UNIT.equals(po.getType())) {
            list = analysisMapper.waterSupplyTemperatureUnitAnalysis(po);
        } else {
            list = analysisMapper.waterSupplyTemperatureHouseholdAnalysis(po);
        }

        if (CollectionUtils.isEmpty(list)) {
            return new HashMap<>();
        }
        //目前返回的日期格式为年-月-日 时  用java的stream把日期格式的分和秒补：00
        list.stream().forEach(x -> {
            x.setCreateTime(x.getCreateTime() + ":00:00");
        });


        String type = po.getType();
        for (HeatAnalysisVo vo : list) {
            if (type.equals(AgreementConstants.DataType.PLOT)) {
                vo.setName(vo.getPlotName());
            } else if (type.equals(AgreementConstants.DataType.BUILD)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName());
            } else if (type.equals(AgreementConstants.DataType.BUILD_UNIT)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName() + "-" + vo.getUnitName());
            } else if (type.equals(AgreementConstants.DataType.HOUSEHOLD)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName() + "-" + vo.getUnitName() + "-" + vo.getHouseNumber());
            }
        }
        Map<String, List<HeatAnalysisVo>> collect;
        Map<String, List<HeatAnalysisVo>> returnMap = new HashMap<>();
        collect = list.stream().collect(Collectors.groupingBy(HeatAnalysisVo::getName));

        Iterator<Map.Entry<String, List<HeatAnalysisVo>>> entries = collect.entrySet().iterator();
        List<HeatAnalysisVo> mapValue;
        String mapKey;
        while (entries.hasNext()) {
            Map.Entry<String, List<HeatAnalysisVo>> entry = entries.next();
            mapKey = entry.getKey();
            mapValue = entry.getValue();
//            mapValue = FormatData.getTIme(mapValue, po.getTimePoint());
            returnMap.put(mapKey, mapValue);
        }
        return returnMap;
    }

    public Map<String, List<HeatAnalysisVo>> returnWaterTemperatureAnalysis(DataAnalysisPo po) {
        List<HeatAnalysisVo> list;
        if (AgreementConstants.DataType.PLOT.equals(po.getType())) {
            list = analysisMapper.returnWaterTemperaturePlotAnalysis(po);
        } else if (AgreementConstants.DataType.BUILD.equals(po.getType())) {
            list = analysisMapper.returnWaterTemperatureBuildAnalysis(po);
            // 使用自定义比较器对列表进行排序
        } else if (AgreementConstants.DataType.BUILD_UNIT.equals(po.getType())) {
            list = analysisMapper.returnWaterTemperatureUnitAnalysis(po);
        } else {
            list = analysisMapper.returnWaterTemperatureHouseholdAnalysis(po);
        }

        if (CollectionUtils.isEmpty(list)) {
            return new HashMap<>();
        }

        //目前返回的日期格式为年-月-日 时  用java的stream把日期格式的分和秒补：00
        list.stream().forEach(x -> {
            x.setCreateTime(x.getCreateTime() + ":00:00");
        });

        String type = po.getType();
        for (HeatAnalysisVo vo : list) {
            if (type.equals(AgreementConstants.DataType.PLOT)) {
                vo.setName(vo.getPlotName());
            } else if (type.equals(AgreementConstants.DataType.BUILD)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName());
            } else if (type.equals(AgreementConstants.DataType.BUILD_UNIT)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName() + "-" + vo.getUnitName());
            } else if (type.equals(AgreementConstants.DataType.HOUSEHOLD)) {
                vo.setName(vo.getPlotName() + "-" + vo.getBuildName() + "-" + vo.getUnitName() + "-" + vo.getHouseNumber());
            }
        }
        Map<String, List<HeatAnalysisVo>> collect;
        Map<String, List<HeatAnalysisVo>> returnMap = new HashMap<>();
        collect = list.stream().collect(Collectors.groupingBy(HeatAnalysisVo::getName));

        Iterator<Map.Entry<String, List<HeatAnalysisVo>>> entries = collect.entrySet().iterator();
        List<HeatAnalysisVo> mapValue;
        String mapKey;
        while (entries.hasNext()) {
            Map.Entry<String, List<HeatAnalysisVo>> entry = entries.next();
            mapKey = entry.getKey();
            mapValue = entry.getValue();
//            mapValue = FormatData.getTIme(mapValue, po.getTimePoint());
            returnMap.put(mapKey, mapValue);
        }
        return returnMap;
    }

    public Map<String, List<TemperatureAnalysisTimeVo>> outTemperatureAnalysis(DataAnalysisPo po) {
        List<TemperatureAnalysisTimeVo> list;
        List<Long> plotIds;
        if (AgreementConstants.DataType.PLOT.equals(po.getType())) {
            list = analysisMapper.dataPlotOutdoorTemperature(po);
        } else if (AgreementConstants.DataType.BUILD.equals(po.getType())) {
            plotIds = buildService.list(new LambdaQueryWrapper<>(CBuild.class).in(CBuild::getId, po.getIds()))
                    .stream().map(CBuild::getPlotId).collect(Collectors.toList());
            po.setIds(plotIds);
            list = analysisMapper.dataBuildOutdoorTemperature(po);
        } else if (AgreementConstants.DataType.BUILD_UNIT.equals(po.getType())) {
            plotIds = buildUnitService.list(new LambdaQueryWrapper<>(BuildUnit.class).in(BuildUnit::getId, po.getIds()))
                    .stream().map(BuildUnit::getLotId).collect(Collectors.toList());
            po.setIds(plotIds);
            list = analysisMapper.dataUnitOutdoorTemperature(po);
        } else {
            plotIds = householdService.list(new LambdaQueryWrapper<>(Household.class).in(Household::getId, po.getIds()))
                    .stream().map(Household::getPlotId).collect(Collectors.toList());
            po.setIds(plotIds);
            list = analysisMapper.dataHouseholdOutdoorTemperature(po);
        }
        if (CollectionUtils.isEmpty(list)) {
            return new HashMap<>();
        }
        list = list.stream()
                .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getName() + ";" + o.getReportTime()))), ArrayList::new));
        list = list.stream().filter(x -> x.getReportTime().before(new Date())).collect(Collectors.toList());
        list = list.stream().sorted(Comparator.comparing(TemperatureAnalysisTimeVo::getReportTime)).collect(Collectors.toList());
        Map<String, List<TemperatureAnalysisTimeVo>> collect;
        Map<String, List<TemperatureAnalysisTimeVo>> returnMap = new HashMap<>();
        collect = list.stream().collect(Collectors.groupingBy(TemperatureAnalysisTimeVo::getName));

        Iterator<Map.Entry<String, List<TemperatureAnalysisTimeVo>>> entries = collect.entrySet().iterator();
        List<TemperatureAnalysisTimeVo> mapValue;
        String mapKey;
        while (entries.hasNext()) {
            Map.Entry<String, List<TemperatureAnalysisTimeVo>> entry = entries.next();
            mapKey = entry.getKey();
            mapValue = entry.getValue();
//            mapValue = FormatData.getTIme(mapValue, po.getTimePoint());
            returnMap.put(mapKey, mapValue);
        }
        return returnMap;
    }
}
